# 爬取百度网页整体数据

import requests
from fake_useragent import FakeUserAgent  # 需下载fake_useragent第三方库

# 定义网址
url = 'https://www.baidu.com'

# 定义请求头
headers = {'User-Agent': FakeUserAgent().random}

# 发起网络请求
response = requests.get(url, headers=headers)

# 保存网址
with open('baidu.html', 'w', encoding='utf-8') as file:
    file.write(response.text)
